package com.sky.config;

import com.sky.properties.AliOssProperties;
import com.sky.utils.AliOssUtil;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * AliOssUtilConfiguration
 *
 * @author liliudong
 * @version 1.0
 * @description
 * @date 2023/7/28 11:22
 */
@Configuration
@EnableConfigurationProperties(AliOssProperties.class)
public class AliOssUtilConfiguration {

    /**
     * 阿里oss上传工具
     *
     * @return {@link AliOssUtil}
     */
    @Bean
    public AliOssUtil aliOssUtil(AliOssProperties aliOssProperties) {
        return new AliOssUtil(aliOssProperties.getEndpoint(),
                aliOssProperties.getAccessKeyId(),
                aliOssProperties.getAccessKeySecret(),
                aliOssProperties.getBucketName());
    }
}
